package com.huaxin.device.dto.enums.validator;

import com.huaxin.device.dto.enums.AlarmLevel;
import com.huaxin.device.dto.enums.validation.ValidAlarmLevel;
import jakarta.validation.ConstraintValidator;
import jakarta.validation.ConstraintValidatorContext;

public class AlarmLevelValidator implements ConstraintValidator<ValidAlarmLevel, Integer> {
    @Override
    public boolean isValid(Integer value, ConstraintValidatorContext context) {
        if (value == null) {
            return true;
        }
        return AlarmLevel.isValid(value);
    }
}